#pragma once


typedef void (* lpfnRegisterNativeMethods)(JNIEnv* env, jclass clazz);

class JniObject;
class JniObjectFactory {
public:
    JniObjectFactory() {}
    virtual ~JniObjectFactory() { unreg(); }

    static JniObject* createByClassName(const char * name); 

protected:
    void reg(const char * name);
    void unreg();

private:
    virtual JniObject* doCreate() = 0;
};

class JniObjectNativeMethodHelper {
public:
    JniObjectNativeMethodHelper(lpfnRegisterNativeMethods func, const char * className = NULL);
    static void RegisterAllNatives(JNIEnv* env);
};


